package com.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.commons.PageInfo;
import com.dao.MessageDao;
import com.dao.MessageDaoImpl;

import vo.User;

/**
 * Servlet implementation class GetSendMessageServlet
 */
@WebServlet("/getSendMessage.do")
public class GetSendMessageServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public GetSendMessageServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
				//获得当前登录人的ID
				Integer userid=((User)request.getSession().getAttribute("user")).getUserid();
				PageInfo info=new PageInfo(request);//创建时就把info放进了request
				//创建dao
				MessageDao dao=new MessageDaoImpl();
				request.setAttribute("list", dao.getSendMessage(userid,info));
				//转发
				request.getRequestDispatcher("checkSend.jsp").forward(request, response);
	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
